package com.qf.service.impl;

import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User findUserById(Integer uid) {
        return null;
    }

    @Override
    public Boolean addUser(User user) {
        int i = userMapper.subUser(user);
        System.out.println(i);
        if(i>0){
            return true;
        }
        return false;
    }

    @Override
    public User findUserBytel(String tel, String password) {

        User user = userMapper.selectUserByTel(tel,password);

        if (user!=null){
            return user;
        }
        return null;
    }

    @Override
    public Boolean updateUser(User user,String tel) {

        //拿出user的bean属性tel
        String nowtel = user.getTel();

//        System.out.println(nowtel);
        //调用数据层
        int in = userMapper.updateUserByTel(nowtel,tel);
        System.out.println(in);
        if (in>0){
            return true;
        }
        return false;
    }


}
